package com.xb.loan.admin.service.app.impl;

import com.xb.hehe.app.dto.TLoanPlatformDTO;
import com.xb.hehe.app.service.TLoanPlatformService;
import com.xb.loan.admin.dao.app.PlatformDao;
import com.xb.loan.admin.service.app.PlatformServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.plugin.services.PlatformService;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("platformServer");
public class PlatformServerImpl implements PlatformServer {

    @Autowired
    TLoanPlatformService tLoanPlatformService;

    @Autowired
    PlatformDao platformDao;

    @Override
    public Long saveTLoanPlatformDTO(TLoanPlatformDTO tLoanPlatformDTO) {
        return tLoanPlatformService.saveTLoanPlatform(tLoanPlatformDTO);
    }

    @Override
    public Long updateTLoanPlatformDTO(TLoanPlatformDTO tLoanPlatformDTO) {
        return tLoanPlatformService.updateTLoanPlatform(tLoanPlatformDTO);
    }

    @Override
    public TLoanPlatformDTO queryTLoanPlatformDTOById(String id) {
        return tLoanPlatformService.queryTLoanPlatformById(id);
    }

    @Override
    public List<Map<String, Object>> queryPlatformList(int pageSize, int pageNum, int isRelease, String platformName) {
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("pageSize",pageSize);
        map.put("pageNum",pageNum);
        map.put("isRelease",isRelease);
        map.put("platformName",platformName);
        return platformDao.queryPlatfromList(map);
    }

    @Override
    public int queryPlatformCount(int isRelease, String platformName) {
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("isRelease",isRelease);
        map.put("platformName",platformName);
        return platformDao.queryPlatfromCount(map);
    }
}
